package listbyorder.access1001a.test1551;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/8/31 16:40
 */
public class Solution1 {

    public int minOperations(int n) {
        if (n <= 2) return n - 1;
        if ((n & 1) == 1) {
            // n是奇数的时候
            int c = n / 2;
            return (n + 1) * c / 2;
        } else {
            // n是偶数的时候
            int c = n / 2;
            return n * c / 2;
        }
    }
}
